 <?php 
 
 $target = "upload/"; 
 $fileName = 'file'; //COLOCAR O NOME DO LOGIN AQUI
 $finalFileName = $fileName . '.avi';
 
 $target = $target . $finalFileName ; 
 $ok=1; 
 
 //This is our size condition 
 if ($uploaded_size > 350000) { 
    echo "<script> alert('Your file is too large.'); location.href = 'uploadVideo.php'; </script>";
    $ok=0; 
 } 
 
 //This is our limit file type condition 
 if (!($uploaded_type=="video/mp4") || !($uploaded_type=="x-msvideo")) {
    echo "<script> alert('You may only upload MP4 or AVI files.'); location.href = 'uploadVideo.php'; </script>";
    $ok=0;
 }
 
 //Here we check that $ok was not set to 0 by an error 
 if ($ok==0) { 
    echo "<script> alert('Sorry your file was not uploaded.');location.href = 'uploadVideo.php'; </script>";
 } 
  //If everything is ok we try to upload it 
 else {
    if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) { 
        echo "<script> alert('The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded'); </script>";
    } else { 
        echo "<script> alert('Sorry, there was a problem uploading your file.'); location.href = 'uploadVideo.php'; </script>";
    } 
 } 
 ?> 
